#include <cstdint>
#include <iostream>
#include <set>
#include <utility>
#include <vector>

using ll = int64_t;


ll k;
std::vector<std::pair<ll, ll>> v;

std::set<ll> s;

enum struct nt{
    p,
    l
};

int main(){
    std::cin>>k;
    for(ll i=1;i<=k;i++){
        std::cin>>v[i].first>>v[i].second;
        s.insert(v[i].first);
        s.insert(v[i].second);
    }
    auto it = s.begin();
    ll ln=1;
    while(it!=s.end()){
        
    }
}